package com.xxmw.transaction.service.app;

import com.baomidou.mybatisplus.extension.service.IService;
import com.xxmw.transaction.common.entity.P;
import com.xxmw.transaction.model.app.BourseApi;
import com.xxmw.transaction.model.app.BoursePrice;
import com.xxmw.transaction.model.app.Hedging;
import com.xxmw.transaction.model.subscribe.SymbolSub;
import com.xxmw.transaction.service.support.Subject;
import com.xxmw.transaction.service.support.SubscribeWebSocket;
import com.xxmw.transaction.vo.BrickableSymbol;

import java.math.BigDecimal;
import java.util.List;
import java.util.Set;

/**
 * @author luowenliang
 * @since 2020/2/17 15:52
 */
public interface SymbolSubService extends IService<SymbolSub>, Subject {

    /**
     * 订阅列表获取
     * @param pageNum
     * @param pageSize
     * @param bourse
     * @return
     */
    P<SymbolSub> pageList(Integer pageNum, Integer pageSize, Integer bourse);

    /**
     * 获取所有已开启订阅的列表
     * @return
     */
    List<SymbolSub> openBrickList (String endWith);

    List<SymbolSub> findBySymbolId (Integer symbolId);

    /**
     * 根据交易所和交易对获取
     * @param bourse
     * @param symbol
     * @return
     */
    SymbolSub getByBourseAndSymbol (Integer bourse, String symbol);

    /**
     * 获取交易所的订阅列表
     * @param bourse 交易所id
     * @return
     */
    Set<String> listByBourse(Integer bourse);

    /**
     * 根据交易对获取 状态已开启的
     * @param symbol
     * @return
     */
    List<SymbolSub> getBySymbol (String symbol);

    /**
     * 获取交易所价格
     * @param bourse
     * @param symbol
     * @return
     */
    BoursePrice getPrice(Integer bourse, String symbol);

    /**
     * 获取webSocket对象
     * @param bourse
     * @return
     */
    SubscribeWebSocket getWebSocket(Integer bourse);

    /**
     *
     * @param symbol
     * @return
     */
    void getHedging(String symbol);

    /**
     * 获取可搬砖交易对
     * @return
     */
    List<BrickableSymbol> getBrickableSymbol ();

    /**
     * 获取用户的usdt余额
     * @return
     */
    // public BigDecimal getUSDTAmount(String username, Integer bourse);
    public BigDecimal getUSDTAmount(Long apiId);

    public BigDecimal getUSDTAmount(BourseApi api);
}
